#include<iostream>
using namespace std;
const int N = 1e4 + 10, M = 2e5 + 10;
int h[N], e[M], ne[M], idx;
int q[N];
int d[N];
int dis[N];
int n, m;
void add(int a, int b)
{
	e[idx] = b, ne[idx] = h[a], h[a] = idx++;
}
bool topsort()
{
	int hh = 0, tt = -1;
	for (int i = 1; i <= n; i++) {
		if (!d[i]) {
			q[++tt] = i;
			dis[i] = 100;
		}
	}
	while (hh <= tt) {
		int t = q[hh++];
		for (int i = h[t]; ~i; i = ne[i]) {
			int j = e[i];
			if (dis[j] < dis[t] + 1) {
				dis[j] = dis[t] + 1;
			}
			if (--d[j] == 0) {
				q[++tt] = j;
			}
		}
	}
	return tt == n - 1;
}
int main()
{
	cin >> n >> m;
	memset(h, -1, sizeof(h));
	while (m--) {
		int a, b;
		cin >> a >> b;
		add(b, a);
		d[a]++;
	}
	if (!topsort()) {
		cout << "Poor Xed" << endl;
		return 0;
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		ans += dis[i];
	}
	cout << ans << endl;
	return 0;
}